<template>
  <div class="title-container">
    <div class="back" v-if="isShow">
      <svg-icon class="navigation_svg" icon-class="back" @click.stop="back()" />
    </div>
    <div class="title">
      <div class="title-text" v-if="title">{{ title }}</div>
      <svg-icon v-else class="title_svg" icon-class="Logo" />
    </div>
    <div class="menu">
      <svg-icon
        class="navigation_svg"
        icon-class="navigation"
        @click.stop="$emit('popupClick')"
      />
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'

@Component
export default class HeaderView extends Vue {
  @Prop({ default: '' })
  title?: string

  get isShow () : boolean {
    return true
  }

  back () : void {
    this.$router.go(-1)
  }
}
</script>

<style lang="less" scoped>
.title-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  .navigation_svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}
.back {
  position: absolute;
  left: 0.7rem;
  margin-top: auto;
  margin-bottom: auto;
}
.menu {
  position: absolute;
  right: 1rem;
  margin-top: auto;
  margin-bottom: auto;
}
.title {
  .title-text {
    font-family: PingFangSC-Medium,sans-serif;
    font-size: 16px;
    color: #ffffff;
    line-height: 20px;
    font-weight: 500;
  }
  .title_svg {
    width: 9.39rem;
    height: 0.88rem;
  }
}
</style>
